import {
  getBanner,
  getCateList,
  getAdvertisement,
  getFindListGoods,
  getFindRecommendGoods
} from '../../api/index'
Page({
  data: {
    // 轮播图数据
    bannerList: [],
    // 一级分类数据
    cateList: [],
    // 活动宣传数据
    advertisementList: [],
    FindListGoodsList: [],
    FindRecommendGoodslist: [],
    loading: true
  },
  onLoad() {
    this.getBannerList()
    this.getCateList()
    this.getAdvertisement()
    this.getFindListGoods()
    this.getFindRecommendGoods()
    this.setData({
      loading: false
    })
  },
  // 获取轮播图数据
  async getBannerList() {
    const res = await getBanner()
    this.setData({
      bannerList: res.data
    })
  },
  //获取一级分类列表
  async getCateList() {
    const res = await getCateList()
    this.setData({
      cateList: res.data
    })
  },
  // 获取活动宣传
  async getAdvertisement() {
    const {
      data
    } = await getAdvertisement()
    this.setData({
      advertisementList: data
    })
  },
  async getFindListGoods() {
    const res = await getFindListGoods()
    this.setData({
      FindListGoodsList: res.data
    })
  },
  async getFindRecommendGoods() {
    const res = await getFindRecommendGoods()
    this.setData({
      FindRecommendGoodslist: res.data
    })
  },
  // 转发好友，群聊功能
  onShareAppMessage() {
    // 自定义转发内容
    return {
      title: "真爱有你",
      path: "/pages/index/index",
      imageUrl: '../../assets/images/love.jpg'
    }
  },
  // 转发朋友圈功能
  onShareTimeline() {

  }


})